<?php echo $this->BlkListProducts(); ?>

<?php
	$lang = $this->arrParam['lang'];
    if(empty($lang)){
        $lang = 'vi';
    }else{
        $lang = $this->arrParam['lang'];
    }

	$item = $this->Item;
	$name = $item['name'];
	$summary 	= $item['summary'];
	$summary 	= str_replace("\\"," ",$summary);
	$content 	= $item['content'];
	$content 	= str_replace("\\"," ",$content);
	$price 		= $item['price'];
    $selloff 	= $item['selloff'];
    $id = $item['id'];
    if(empty($selloff)){
       $price 	= number_format($price,null) . ' VND';
       $price = '<p class="text-price color-red">Giá: ' . $price . '</p>';
    }else{
       $price 	= number_format($selloff,null) . ' VND';
       $price = '<p class="text-price color-red">Giá: ' . $price . '</p>';
    }
    if($item['price'] == 0 && $item['selloff'] == 0) $price = '';
    
    $realLink	= FILES_PATH.'/products/images450x450/'.$item['picture'];
    if(file_exists($realLink)){
	    $linkImg	= FILES_URL.'/products/images450x450/'.$item['picture'];
	    $picture 	= '<img width="390" height="415" src="'. $linkImg .'" alt="'.$name.'" />';
    }else{
	    $linkImg	= $this->imgUrl.'/no-image.jpg';
	    $picture 	= '<img width="390" height="415" src="'. $linkImg .'" alt="'.$name.'" />';
    }
    
    $linkCart = $this->baseUrl('/products/index/add-item/id/' . $item['id']);
    
    $urlContact 	= array('module'=>'default','controller'=>'index','action'=>'contact','lang'=>$lang);
   	$linkContact 	= $this->url($urlContact,'contact');
?>

<div class="content margin-top-20">
 	<div class="group-new02 width-100">
         <div class="group-new02-title">
         	<div class="sub-left color-main">
            	<a class="link-sub" href="#"><img src="<?php echo $this->imgUrl;?>/icons/icon-flower04.png" alt="<?php echo $name;?>"  /></a>
                	<p>Chi tiết sản phẩm</p>
                        </div>
                    </div>
                    <div class="group-3 width-100">
          <!-----Col Left------>
                        <div class="col-pro-left width-40 float-left">
                            <div class="boxpro">
                                <div class="boxpro-img"><?php echo $picture; ?></div>
                                <div class="boxpro-thumb">
                                    <img src="<?php echo $this->imgUrl;?>/default/thumbnail01.jpg" width="100" height="100" alt="" />
                                    <img src="<?php echo $this->imgUrl;?>/default/thumbnail02.jpg" width="100" height="100" alt="" />
                                    <img src="<?php echo $this->imgUrl;?>/default/thumbnail03.jpg" width="100" height="100" alt="" />
                                </div>
                            </div>
                        </div>
          <!-----Col Left(End)------>
          <!-----Col Right------>
                        <div class="col-pro-right width-55 float-right">
                            <div class="boxpro-note">
                                <div class="title"><h1><?php echo $name;?></h1></div>
                                <div class="described"><p><?php echo $summary;?></p>
                                </div>
                                <div class="price-pro"><p><?php echo $price;?></p></div>
                                <div class="button">
                                    <div class="btn-datmua width-70 float-left"><a href="#">Thêm vào giỏ hàng</a></div>
                                    <div class="numb width-30 float-right">
                                        <span class="so"><p>1</p></span>
                                        <span><p>Số lượng</p></span>
                                    </div>
                                    <div class="clear"></div>
                                </div>
                            </div>
                            <div class="boxpro-comments">
                            <?php
                        		$info = new Zendvn_System_Info();
								$memberInfo = $info->getMemberInfo('id');
								if($memberInfo != ''){
									$tbltUser 	= new Zendvn_Models_Users();
									$user 		= $tbltUser->listItem($this->arrParam,array('user_id'=>$memberInfo,'task'=>'public'));
									$group_id 	= $user['group_id'];
								}
								$email		=	$this->formText('email',null,array("class"=>"text"));
								$full_name	=	$this->formText('full_name',null,array("class"=>"text"));
								$email		=	$this->formText('email',null,array("class"=>"text"));
								$title		= 	$this->formText('title',null,array("class"=>"text"));
								$hidden		= 	$this->formHidden('pro_id',$id,array("class"=>"text"));
								$hidUser	= 	$this->formHidden('user_id',$group_id,array("class"=>"text"));
								$content	= 	$this->formTextarea('content',null,array('rows'=>10));
								
								$captcha 	= 	$this->captcha;
								$txtCaptcha = 	$this->formText('captcha','');
								$txtID 		= 	$this->formHidden('captchaID',$this->captcha_id);		
								$urlCaptch		 = $this->baseUrl('default/index/captcha-image');	
								$inputCaptcha	= $this->formText('captcha',null,array("class"=>"code text"));
								
								$submit		= $this->formSubmit('Submit','Gửi bình luận');
								
								
								$formFullname 	= '<div class="lev">
													<span class="sub">Họ tên</span>'
													. $full_name . '</div>';
													
								$formEmail 		= '<div class="lev">
													<span class="sub">Email</span>'
													. $email . '</div>';
													
								$formTitle 		= '<div class="lev">
													<span class="sub">Tiêu đề</span>'
													. $title . $hidden . $hidUser .'</div>';
													
								$formContent 	= '<div class="lev">
												<span class="sub">Nội dung</span>'
												. $content . '</div>';
												
								$formSubmit  	= '<div class="lev">'
												. $submit .
												'</div>';
												
								if($group_id > 0){
									$input = $formTitle . $formContent ;
								}else{
									$input = $formFullname . $formEmail . $formTitle . $formContent ;
								}
                        	?>
                            
                            
                            
                                <div class="form-contact no-border">
                                	<div class="title-form"><p>Ý kiến</p></div>
                                	<form name="contact" action="" method="post">
                                    	<?php echo $input; ?>
                                    	<div class="lev">
						                  <span>Nhập mã: </span>
						                  	<?php echo $inputCaptcha;?>                            	
						                  	<?php if(!empty($this->messageError['captcha'])):echo '<span class="msg_error">'.$this->messageError['captcha'].'</span>';endif;?>
						            	</div>
						            	<div class="lev">
						             		<div>
												<div class="border-img"><?php echo $txtID . $captcha;?></div>
						             	  	</div>
						            	 </div>
                        			
                        			<?php echo $formSubmit?>
						            	
                                    </form>
                                </div>
                            </div>
                        </div>
          <!-----Col Right (End)------>
        	</div>
		<div class="clear"></div>
	</div>
</div>